package com.example.yskjproject.ui.fragment;

import android.view.LayoutInflater;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.example.yskjproject.base.BaseFragment;
import com.example.yskjproject.databinding.UseGettingStartedFragmentBinding;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.SimpleExoPlayer;

/**
 * 使用入门
 */
public class  UseGettingStartedFragment extends BaseFragment {

    private UseGettingStartedFragmentBinding useDataBind;
    @Override
    protected UseGettingStartedFragmentBinding onCreateViewBinding(@NonNull LayoutInflater inflater, @Nullable ViewGroup parent) {
        useDataBind = UseGettingStartedFragmentBinding.inflate(inflater,parent,false);
        return useDataBind;
    }

    @Override
    protected void onData() {
        SimpleExoPlayer mPlayer = new SimpleExoPlayer.Builder(getActivity()).build();
        useDataBind.playView.setPlayer(mPlayer);
        MediaItem mediaItem = MediaItem.fromUri("https://file.originalbody.cn/video/test-1920x1080.mp4");
        mPlayer.setMediaItem(mediaItem);
        mPlayer.play();

        SimpleExoPlayer mPlayer2 = new SimpleExoPlayer.Builder(getActivity()).build();
        useDataBind.playView.setPlayer(mPlayer2);
        MediaItem mediaItem2 = MediaItem.fromUri("https://file.originalbody.cn/video/test-1920x1080.mp4");
        mPlayer2.setMediaItem(mediaItem2);
        mPlayer2.play();

    }
}
